using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO;

using MVPlan.Engine;
using MVPlan.Engine.Dive;
using MVPlan.Engine.Gases;
using MVPlan.Engine.Modeling;
using MVPlan.Engine.Segment;
using MVPlan.Reporting;

namespace MVPlan.Test
{
    class Program
    {
        static void Main(string[] args)
        {

            //using (FileStream f = new FileStream(@"c:\temp\prefs.xml", FileMode.Create))
            //{
            //    Prefs.Serialize(f);
            //}

            //using (FileStream f = new FileStream(@"c:\temp\prefs.xml", FileMode.Open))
            //{
            //    Prefs.Deserialize(f);
            //}
            
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "TextWriterOutput.log"))
            {
                File.Delete(AppDomain.CurrentDomain.BaseDirectory + "TextWriterOutput.log");
            }

            List<Gas> gases = new List<Gas>();
            List<SegmentDive> segments = new List<SegmentDive>();

            gases.Add(new Gas(0.21, .35));
            //gases.Add(new Gas(0.5, 0));
            //gases.Add(new Gas(1, 0));
            //gases.Add(new Gas(0.21, 0));

            segments.Add(new SegmentDive(50, 20, new Gas(0.21, .35), .17));
            //segments.Add(new SegmentDive(30, 0, new Gas(0.5, 0), 0));
            //segments.Add(new SegmentDive(6, 0, gases[2], 0));
            //segments.Add(new SegmentDive(3, 0, gases[3], 0));

            Profile p = new Profile(segments, gases, null);

            p.IsOCDeco = false;

            //p.Cylinders.Add(new Cylinder(3, 200, gases[0]));
            //p.Cylinders.Add(new Cylinder(3, 50, gases[1]));
            //p.Cylinders.Add(new Cylinder(3, 50, gases[2]));

            ProfileStatus status = p.DoDive();

            switch (status)
            {
                case ProfileStatus.Success:

                    Console.Write(p.ToString());

                    p.DoGasCalcs();

                    Console.ReadLine();

                    break;
                case ProfileStatus.ProcessingError:
                    break;
                case ProfileStatus.InfiniteDeco:
                    break;
                case ProfileStatus.NothingToProcess:
                    break;
                case ProfileStatus.CeilingViolation:
                    break;
            }            
        }
    }
}
